//package com.bingquan.company.global.exception;
//
//
//import com.example.pagehelper.entity.common.Result;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.http.HttpStatus;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//
//@Slf4j
//@ControllerAdvice
//public class GlobalExceptionAdvice {
//
//    @ExceptionHandler(Exception.class)
//    @ResponseBody
//    @ResponseStatus(code = HttpStatus.INTERNAL_SERVER_ERROR)
//    public Result handlerException(HttpServletRequest request, Exception e) {
//        log.error("not known  error, "  + e.getMessage());
//        return Result.error(e.getMessage());
//    }
//
//    @ExceptionHandler(HttpException.class)
//    @ResponseBody
//    public Result handlerHttpException(HttpServletRequest request, HttpException e) {
//         log.error("not found  error, "  + e.getMessage());
//         return Result.error(e.getCode(), e.getMsg());
//    }
//
//   // 预设全局参数绑定
//    @ModelAttribute
//    public void presetParam(Model model){
//        model.addAttribute("globalAttr","this is a global attribute");
//    }
//}